<template>
	<view class="cs-container">
		<view class="header">
			<text class="page-title">CS页面</text>
		</view>
		
		<view class="content">
			<view class="welcome-section">
				<text class="welcome-text">欢迎来到CS页面</text>
				<text class="description">这是一个新的页面，支持微信小程序和H5</text>
			</view>
			
			<view class="feature-section">
				<view class="feature-item">
					<text class="feature-title">功能特性</text>
					<text class="feature-desc">• 响应式设计，适配多平台</text>
					<text class="feature-desc">• 使用rpx单位，显示一致</text>
					<text class="feature-desc">• 支持微信小程序和H5</text>
				</view>
			</view>
			
			<view class="button-section">
				<button @click="goBack" class="back-btn">返回首页</button>
				<button @click="testGlobalLoading" class="test-btn" :disabled="globalLoading">
					{{ globalLoading ? '加载中...' : '测试全局Loading' }}
				</button>
			</view>
		</view>
		
		<!-- 全局loading组件 -->
		<global-loading :show="globalLoading"></global-loading>
	</view>
</template>

<script>
	import GlobalLoading from '@/components/global-loading/global-loading.vue'
	import globalLoadingMixin from '@/mixins/globalLoading.js'
	
	export default {
		components: {
			GlobalLoading
		},
		mixins: [globalLoadingMixin],
		data() {
			return {
				
			}
		},
		onLoad() {
			console.log('CS页面加载')
		},
		methods: {
			goBack() {
				// 返回上一页
				uni.navigateBack({
					delta: 1
				})
			},
			testGlobalLoading() {
				// 测试全局loading
				this.$showLoadingWithAutoHide({
					text: 'CS页面加载中...',
					type: 'spinner',
					size: 'large'
				}, 3000)
			}
		}
	}
</script>

<style lang="scss" scoped>
.cs-container {
	min-height: 100vh;
	background-color: #f5f5f5;
}

.header {
	background-color: #007aff;
	padding: 40rpx 30rpx;
	text-align: center;
	
	.page-title {
		font-size: 36rpx;
		font-weight: bold;
		color: #ffffff;
	}
}

.content {
	padding: 40rpx 30rpx;
}

.welcome-section {
	background-color: #ffffff;
	border-radius: 16rpx;
	padding: 40rpx 30rpx;
	margin-bottom: 30rpx;
	text-align: center;
	
	.welcome-text {
		font-size: 32rpx;
		font-weight: bold;
		color: #333333;
		display: block;
		margin-bottom: 20rpx;
	}
	
	.description {
		font-size: 28rpx;
		color: #666666;
		line-height: 1.5;
	}
}

.feature-section {
	background-color: #ffffff;
	border-radius: 16rpx;
	padding: 40rpx 30rpx;
	margin-bottom: 30rpx;
	
	.feature-item {
		.feature-title {
			font-size: 32rpx;
			font-weight: bold;
			color: #333333;
			display: block;
			margin-bottom: 20rpx;
		}
		
		.feature-desc {
			font-size: 28rpx;
			color: #666666;
			line-height: 1.8;
			display: block;
			margin-bottom: 10rpx;
		}
	}
}

.button-section {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 20rpx;
	
	.back-btn {
		background-color: #007aff;
		color: #ffffff;
		border: none;
		border-radius: 8rpx;
		padding: 20rpx 60rpx;
		font-size: 28rpx;
		min-width: 200rpx;
		
		&:active {
			background-color: #0056cc;
		}
	}
	
	.test-btn {
		background-color: #28a745;
		color: #ffffff;
		border: none;
		border-radius: 8rpx;
		padding: 20rpx 60rpx;
		font-size: 28rpx;
		min-width: 200rpx;
		
		&:active {
			background-color: #1e7e34;
		}
	}
}
</style> 